<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('施工人员管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>编号：</label>
                                <input type="text" name="bh"/>
                            </li>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/kqproject";
        
        var datassex = [[${@dict.getType('sys_user_sex')}]];
        var datasbanz = [[${@dict.getType('gys_banz')}]];
        var datasgongz = [[${@dict.getType('gys_gongz')}]];

        $(function() {
            var options = {
                url: prefix + "/subPersonlist",
                modalName: "施工人员管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'sex',
                    title: '性别',
                    formatter: function(value, row, index) {
                    	return $.table.selectDictLabel(datassex, value);
                    }
                },
                {
                    field: 'card',
                    title: '身份证号'
                },
                {
                    field: 'phone',
                    title: '联系电话'
                },
                {
                    field: 'address',
                    title: '联系地址'
                },
                {
                    field: 'suosbz',
                    title: '所属班组',
                    formatter: function(value, row, index) {
                    	return $.table.selectDictLabel(datasbanz, value);
                    }
                },
                {
                    field: 'gongz',
                    title: '工种',
                    formatter: function(value, row, index) {
                    	return $.table.selectDictLabel(datasgongz, value);
                    }
                },
                {
                    field: 'khyh',
                    title: '开户银行'
                },
                {
                    field: 'skzh',
                    title: '收款账号'
                },
                {
                    field: 'jinjlxr',
                    title: '紧急联系人'
                },
                {
                    field: 'jinjlxrdh',
                    title: '紧急联系人电话'
                }]
            };
            $.table.init(options);
        });
        
        /* 添加用户-选择用户-提交(子页面调用父页面形式) */
		function submitHandler(index, layero) {
			var rows = layero.find("iframe")[0].contentWindow.getSelections();
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
			
			$.modal.close();
		}
        
		/* 添加用户-选择商品-提交(回调形式-父页面调用子页面) */
		function getSelections() {
			return $("#" + table.options.id).bootstrapTable('getSelections');
		}
    </script>
</body>
</html>